<template>
	<view class="content padding">
		<view class="head padding shadow">
			<view class="info flex flex-direction justify-between" style="height: 122rpx;">
				<text>ID账号</text>
				<view class="flex align-center  info_o response padding-lr">
					<input type="number" v-model="acctNumL" value="" placeholder="请输入ID账号" />
				</view>
			</view>
			<!-- <view class="info flex flex-direction justify-between" style="height: 122rpx;" v-if="0">
				<text>姓名</text>
				<view class="flex align-center  info_o response padding-lr">
					<input type="text" value="" v-model="nm" placeholder="请输入员工姓名" />
				</view>
			</view> -->
			<view class="margin-tb">或者</view>
			<view class="info flex flex-direction justify-between" style="height: 122rpx;">
				<text>手机号</text>
				<view class="flex align-center  info_o response padding-lr">
					<input type="text" value="" v-model="phnNumL" placeholder="请填写手机号" />
				</view>
			</view>
		</view>
		<view class="head padding shadow margin-top" v-if="0">
			<view class="info flex flex-direction justify-between" style="height: 122rpx;">
				<text>登陆密码</text>
				<view class="flex align-center  info_o response padding-lr">
					<input type="text" value="" placeholder="6-20位（必须包含字母和数字）" />
				</view>
			</view>
			<view class="info flex flex-direction justify-between" style="height: 122rpx;">
				<text>确认密码</text>
				<view class="flex align-center  info_o response padding-lr"><input type="text" value="" placeholder="请再次输入新密码" /></view>
			</view>
		</view>
		<u-toast ref="uToast" />
		<button class="cu-btn determine" @click="confir">确定</button>
	</view>
</template>

<script>
const app = getApp();
export default {
	data() {
		return {
			acctNumL: '',
			phnNumL: '',
		};
	},
	methods: {
		async confir() {
			// [this.acctNum,this.phnNumL].includes()
			console.log('pp.globalData.id, :>> ', app.globalData.smmUser.id);
			if (!this.acctNumL && !this.phnNumL) {
				return this.$refs.uToast.show({ title: '请填写ID账号或者手机号码~~', type: 'error' });
			} else {
				var info;
				var info1;
				this.phnNumL ? (info = this.phnNumL) : (info = '0');
				this.acctNumL ? (info1 = this.acctNumL) : (info1 = 0);

				app.globalData.api.addEmp(app.globalData.smmUser.id, info, info1).then(res => {
					if (res.code == 200) {
						this.$refs.uToast.show({ title: '添加成功~~', type: 'success' });
						setTimeout(() => {
							uni.switchTab({
								url: 'user-center',
							});
						}, 1000);
					}
				});
			}
		},
	},
};
</script>

<style lang="scss">
.content {
	.determine {
		width: 690rpx;
		height: 80rpx;
		background: #f8ce39;
		border-radius: 12rpx;

		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
		line-height: 80rpx;
		margin: 60rpx 0;
	}
	.head {
		width: 690rpx;

		background: #ffffff;
		border-radius: 20rpx;
		.personal {
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
		}
		input {
			width: 100%;
		}
		.info {
			margin-top: 30rpx;
			text {
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #333333;
				&::after {
					content: '*';
					color: red;
					margin-left: 5rpx;
					font-size: 28rpx;
				}
			}
			.info_o {
				width: 630rpx;
				height: 70rpx;
				border: 1rpx solid #e6e6e6;
				border-radius: 6rpx;
			}
		}
	}
}
</style>
